﻿using UnityEngine;

[ExecuteAlways]
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class HexagonMesh : HexagonNode
{
    private void Awake()
    {
        vertices = new Vector3[] {
            new (1,  0),
            new (0.5f,  -g3/2),
            new (-0.5f,  -g3/2),
            new (-1, 0),
            new (-0.5f,  g3/2),
            new (0.5f,  g3/2),
        };
        triangles = new int[] { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 };
        uv = new Vector2[]
        {
            new (1, 0.5f),
            new (0.75f, 0.5f - g3 / 4),
            new (0.25f, 0.5f - g3 / 4),
            new (0, 0.5f),
            new (0.25f, 0.5f + g3 / 4),
            new (0.75f, 0.5f + g3 / 4)
        };
        Draw(0, 0);
    }
}
